﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SuperFox
{
    public partial class ProductLink : UserControl
    {

        public static readonly DependencyProperty TitleProperty =
         DependencyProperty.Register("Title", typeof(String), typeof(ProductLink),
               new PropertyMetadata("", new PropertyChangedCallback(TitlePropertyChanged)));

        public static readonly DependencyProperty UrlProperty =
         DependencyProperty.Register("Title", typeof(String), typeof(ProductLink),
               new PropertyMetadata("", new PropertyChangedCallback(UrlPropertyChanged)));


        public String Title
        {
            get { return (String)GetValue(TitleProperty); }
            set { SetValue(TitleProperty, value); }
        }

        public String Url
        {
            get { return (String)GetValue(UrlProperty); }
            set { SetValue(UrlProperty, value); }
        }


        private static void TitlePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            (d as ProductLink).ContentText.Text = e.NewValue as String;
        }

        private static void UrlPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            (d as ProductLink).LinkButton.NavigateUri = new Uri(e.NewValue as String);
        }



        public ProductLink()
        {
            InitializeComponent();
        }
    }
}
